package com.hupu.jrs.util

import android.content.Context
import android.content.Intent
import android.net.Uri

/**
 * Created by sll on 2016/3/29.
 */
object ShareUtil {

    fun shareImage(mContext: Context, uri: Uri, title: String) {
        val shareIntent = Intent()
        shareIntent.action = Intent.ACTION_SEND
        shareIntent.putExtra(Intent.EXTRA_STREAM, uri)
        shareIntent.type = "image/jpeg"
        mContext.startActivity(Intent.createChooser(shareIntent, title))
    }

    fun share(mContext: Context, extraText: String) {
        val intent = Intent(Intent.ACTION_SEND)
        intent.type = "text/plain"
        intent.putExtra(Intent.EXTRA_SUBJECT, "分享")
        intent.putExtra(Intent.EXTRA_TEXT, extraText)
        val sendIntent = Intent.createChooser(intent, "分享")
        sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
        mContext.startActivity(sendIntent)
    }
}
